package com.aaa.sbms.controller;

import com.aaa.sbms.service.TrainerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @FileName:TrainerController
 * @Description:
 * @Author :99728
 * @Date: 2020/6/12 8:46
 * @Version:1.0.0
 */
@RestController
@RequestMapping("trainer")
public class TrainerController {
    @Autowired
    private TrainerService trainerService;

    /**
     * 培训师列表
     * @param map
     * @return
     */
    @RequestMapping("list")
    public Object getlist(@RequestParam Map map){
        return trainerService.getlist(map);
    }

    /**
     * 分页培训师管理
     * @param map
     * @return
     */
    @RequestMapping("page")
    public Object page(@RequestParam Map map){
        return trainerService.getPage(map);
    }

    /**
     * 根据Id查询数据
     * @param trainerId
     * @return
     */
    @RequestMapping("onelist")
    public Object onelist(Integer trainerId){
        return trainerService.onelist(trainerId);
    }

    @RequestMapping("getCourseName")
    public Object getCourseName(@RequestParam Map map){
        return trainerService.getCourseName(map);
    }

    /**
     * 添加
     * @param map
     * @return
     */
    @RequestMapping("add")
    public  Object add(@RequestBody Map map){
        return trainerService.add(map);
    }

    /**
     * 更新
     * @param map
     * @return
     */
    @RequestMapping("update")
    public Object update(@RequestBody Map map){
        return trainerService.update(map);
    }

    /**
     * 删除
     * @param trainerId
     * @return
     */
    @RequestMapping("delete")
    public Object delete(int trainerId){
        return trainerService.delete(trainerId);
    }

}
